import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.geom.Rectangle;
import flash.geom.Point;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.display.Sprite;
import flash.ui.Keyboard;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.filters.GlowFilter;
 


import flash.utils.Timer;
import haxe.Timer;
import flash.events.Event;


import Images;  
import Blob;

class Character
{
  public var moving : Int;
  public var movingRight : Bool;
  public var postion : Point;
  public var jumping : Int;
  public var attacking : Int;
  public var hit : Int;
  public var characterType : String;
  var moveSpeed : Int;
  var jumpSpeed : Int;
  var attackSpeed : Int;
  public var attackPostion : Point;
  public var health : Int;
  public var attackPower : Int;

public var CurrentCharacter : Blob;
public var attack : Blob;

public function new(inPostion:Point,inMoveSpeed:Int,inJumpSpeed:Int,inAttackSpeed:Int,inHealth:Int,inAttackPower:Int)
  {
  moving = 0;
  jumping = 0;
  postion = inPostion;
  moveSpeed = inMoveSpeed;
  jumpSpeed = inJumpSpeed;
  attackPostion = new Point(0,0);
  attackSpeed = inAttackSpeed;
  health = inHealth;
  attackPower = inAttackPower;
  movingRight = true;
  attacking = 0;
  hit = 0;
  }

// public function copy(inCharacter:Character)
// {
//   moving = inCharacter.moving;
//   movingRight = inCharacter.movingRight;
//   postion = inCharacter.postion;
//   jumping = inCharacter.jumping;
//   characterType = inCharacter.characterType;
//   moveSpeed = inCharacter.moveSpeed;
//   jumpSpeed = inCharacter.jumpSpeed;
//   stand = inCharacter.stand; 
//   standLeft = inCharacter.standLeft;
//   move1 = inCharacter.move1;
//   move2 = inCharacter.move2;
//   move3 = inCharacter.move3;
//   move1_left = inCharacter.move1_left;
//   move2_left = inCharacter.move2_left;
//   move3_left = inCharacter.move3_left;
//   shoot = inCharacter.shoot;
//   attack = inCharacter.attack;
//   attackRight = inCharacter.attackRight;
//   attackLeft = inCharacter.attackLeft ;
//   attackDown = inCharacter.attackDown ;
//   CurrentCharacter = inCharacter.CurrentCharacter;
// 
// }

public function MoveRight()
{
 postion.x = postion.x + moveSpeed;
 movingRight = true;
}

public function MoveLeft()
{
 postion.x = postion.x - moveSpeed;
 movingRight = false;
}

//Any Movement during this render.
public function Move(ground:Int)
{
    if(jumping >= 1)
	{
	  var maxlimit = jumpSpeed/3 + 10;
	  if(jumping >= 1 && jumping < maxlimit)
	  {
	  postion.y = postion.y - jumpSpeed/50;
	  jumping++;
	  }
	  if(jumping >= maxlimit && postion.y < ground)
	  {
	  postion.y = postion.y + jumpSpeed/50;
	  jumping++;
	  }
	  if(jumping >= maxlimit && postion.y >= ground)
	  {
	  jumping = 0;
	  }
	}
    //Fall of rise/ if character size changes?
    if(attacking > 0)
       {
          if(attacking >= attackSpeed)
           {
	     attacking = 0;
           }
	  else
	  {
	     attacking++;
	  }

       }
}

public function Jump()
{
     if(jumping <= 0)
       {
	jumping = 1;
       }  
}

public function getCharacter(mKeyDown:Array<Bool>)
{
       
}

public function getAttack(mKeyDown:Array<Bool>)
{
       
}


}

